﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataBaseLib.Entities
{
    public class BaseEntity
    {
        /// <summary>
        /// 通用数据库结构基础
        /// </summary>
        public BaseEntity()
        {
            UpdatedDateTime = DateTime.Now;
            CreatedDateTime = CreatedDateTime ?? UpdatedDateTime;
        }
        /// <summary>
        /// 通用主键Id
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 通用创建时间
        /// </summary>
        public DateTime? CreatedDateTime { get; set; }

        /// <summary>
        /// 通用修改时间
        /// </summary>
        public DateTime? UpdatedDateTime { get; set; }
    }
}
